﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A77_重写小案例飞机大战中的玩家和敌人
{
    //有生命的物体
    class AnimateObject
    {
        public int hp = 10;

        //受伤
        public void Damage(int value)
        {
            hp -= value;
            if (hp <= 0)
            {
                hp = 0;
                Die();
                return;
            } 
            Console.WriteLine("受到了{0}点伤害,当前血量:{1}", value, hp);
        }

        //死亡
        public virtual void Die()
        {
            Console.WriteLine("在场景中销毁");
            Console.WriteLine("播放特效");
        }
    }
}
